package com.chinasofti.Test;


import com.chinasofti.model.Userinfo;
import com.chinasofti.service.UserinfoService;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:spring/applicationContext_spring.xml"})
@ActiveProfiles("production")
public class MyTest{

    @Autowired
    private UserinfoService userinfoService  ;

    @Test
    public void testAdd()  {}

    @Test
    public void testModify()  {}
    @Test
    public void list(){
        long startTime = System.currentTimeMillis();    //获取开始时间
        userinfoService.findAll()  ;
        /*for(Userinfo userinfo:userinfoService.findAll() ) {
              Date time= new Date() ;
              System.out.println(userinfo.getUsername()) ;
       }*/
        long endTime = System.currentTimeMillis();    //获取结束时间
        System.out.println("程序运行时间：" + (endTime - startTime) + "ms");    //输出程序运行时间
        }


        }